<!--
  * 业务员对账明细
  *
-->
<template>
  <div>
    <a-table :dataSource="tableData" :columns="columns" :pagination="false" rowKey="id" size="small" bordered
      ><template #bodyCell="{ text, record, column }">
        <template v-if="column.dataIndex === 'image'">
          <div class="smart-table-operate">
            <!-- <a-image :width="30" :src="text" /> -->
            <a-image :width="text ? 30 : 50" :src="text || failImg" />
          </div>
        </template>
        <template v-if="column.dataIndex === 'pay_type'">
          <span>{{ getDescByValue('PAY_STA_ENUM', text) }}</span>
        </template>
      </template>
    </a-table>
  </div>
</template>
<script setup lang="ts">
import { useEnums } from '@/hooks/plugins/useEnums'
import failImg from '@/assets/images/notice/failImg.png'
const { getDescByValue } = useEnums()
const props = defineProps({
  enterpriseId: {
    type: Array,
    default: null
  }
})

const columns = reactive([
  {
    title: '门店名称',
    dataIndex: ['store', 'name']
  },
  {
    title: '收款方式',
    dataIndex: 'pay_type'
  },
  {
    title: '应收金额',
    dataIndex: 'money'
  },
  {
    title: '收款凭证',
    dataIndex: 'image'
  },
  {
    title: '备注',
    dataIndex: 'remark'
  },
  {
    title: '签收时间',
    dataIndex: 'create_time'
  }
])
const tableData = ref([])

watch(
  () => props.enterpriseId,
  (e) => {
    if (e) {
      tableData.value = e
    }
  },
  { immediate: true }
)
</script>
